# Contributor: Francesco Colista <fcolista@alpinelinux.org>
# Maintainer: Francesco Colista <fcolista@alpinelinux.org>
pkgname=ofono
pkgver=1.34
pkgrel=0
pkgdesc="Infrastructure for building mobile telephony (GSM/UMTS) applications"
url="https://01.org/ofono"
arch="all"
license="GPL-2.0-only"
depends="bluez mobile-broadband-provider-info"
makedepends="glib-dev dbus-dev ell-dev eudev-dev
	linux-headers bsd-compat-headers libexecinfo-dev"
subpackages="$pkgname-dev $pkgname-doc $pkgname-openrc $pkgname-scripts::noarch"
source="https://www.kernel.org/pub/linux/network/ofono/ofono-$pkgver.tar.xz
	fix-TEMP_FAILURE_RETRY.patch
	skip-broken-test.patch
	$pkgname.initd
	ofono-wheel.conf
	"

build() {
	./configure \
		--prefix=/usr \
		--sysconfdir=/etc \
		--localstatedir=/var \
		--sbindir=/usr/sbin \
		--enable-external-ell \
		--enable-test \
		--with-dbusconfdir=/usr/share
	make
}

check() {
	make -j1 check
}

package() {
	make DESTDIR="$pkgdir" install
	install -Dm644 plugins/ofono.rules "$pkgdir"/usr/lib/udev/rules.d/60-ofono.rules
	install -Dm755 "$srcdir"/$pkgname.initd "$pkgdir"/etc/init.d/$pkgname
	install -Dm755 "$srcdir"/ofono-wheel.conf -t "$pkgdir"/usr/share/dbus-1/system.d/
}

scripts() {
	pkgdesc="$pkgdesc (test scripts)"
	depends="python3 py3-dbus py3-gobject3"

	amove usr/lib/ofono/test
}

sha512sums="
79ebf0bc795288f07b58eeaa1a0aa3309b4afecae3abdd26c0749e22a4c2e74b65e93cbcfdfd1738dbcb2d0cfb8c687d182d706696a7c1cd5b4ed3bcec059489  ofono-1.34.tar.xz
687a2fd592add40122b789073ab9970d6e966752fdecc4077afe1c1bba705fe541dd0e457094f1d9cde747c571b7810b5b1a30835a3f1869bcd810751d5bf76f  fix-TEMP_FAILURE_RETRY.patch
777ab2e13eebd1ccbe12a304310a83b262a5d934207c6a8d410e75aff380838eed1a52f3c2fe0d80c1e7db7faa9b55bf17e78a1e1acd8cfb95a3c6aef49c5b67  skip-broken-test.patch
e2d4f871c47329d82caa06b601d03176032026f28ef85e62fddf1a35f0918ef7d3efeb8dec9b29efd0e750f83f1a485f011370eae5179b479eda1fd07be47c7f  ofono.initd
72cd0cd4bee1f885a990c84f7ed3ef27e0d9d2db37d9a486342204152cb02a67d5197e8014dfea59f1a95285c674695b3dc3cb2b53941781bcfc9b73d5580b1f  ofono-wheel.conf
"
